/*   1:    */ package org.intellij.plugins.relaxNG.compact;
/*   2:    */ 
/*   3:    */

import com.intellij.lang.BracePair;
import com.intellij.lang.Commenter;
import com.intellij.lang.Language;
import com.intellij.lang.PairedBraceMatcher;
import com.intellij.lang.documentation.DocumentationProvider;
import com.intellij.lang.refactoring.NamesValidator;
import com.intellij.openapi.fileTypes.SingleLazyInstanceSyntaxHighlighterFactory;
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.psi.tree.IElementType;
import org.intellij.plugins.relaxNG.compact.psi.RncDefine;
import org.intellij.plugins.relaxNG.compact.psi.RncElement;
import org.intellij.plugins.relaxNG.compact.psi.util.EscapeUtil;
import org.intellij.plugins.relaxNG.compact.psi.util.RenameUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.util.List;

/*   4:    */
/*   5:    */
/*   6:    */
/*   7:    */
/*   8:    */
/*   9:    */
/*  10:    */
/*  11:    */
/*  12:    */
/*  13:    */
/*  14:    */
/*  15:    */
/*  16:    */
/*  17:    */
/*  18:    */
/*  19:    */
/*  20:    */
/*  21:    */
/*  22:    */
/*  23:    */
/*  24:    */
/*  25:    */ 
/*  26:    */ public class RngCompactLanguage
/*  27:    */   extends Language
/*  28:    */ {
/*  29:    */   public static final String ID = "RELAX-NG";
/*  30: 47 */   public static final RngCompactLanguage INSTANCE = new RngCompactLanguage();
/*  31:    */   
/*  32:    */   private RngCompactLanguage()
/*  33:    */   {
/*  34: 50 */     super("RELAX-NG");
/*  35:    */   }
/*  36:    */   
/*  37:    */   public static class MyCommenter
/*  38:    */     implements Commenter
/*  39:    */   {
/*  40:    */     @Nullable
/*  41:    */     public String getLineCommentPrefix()
/*  42:    */     {
/*  43: 57 */       return "#";
/*  44:    */     }
/*  45:    */     
/*  46:    */     @Nullable
/*  47:    */     public String getBlockCommentPrefix()
/*  48:    */     {
/*  49: 63 */       return null;
/*  50:    */     }
/*  51:    */     
/*  52:    */     @Nullable
/*  53:    */     public String getBlockCommentSuffix()
/*  54:    */     {
/*  55: 69 */       return null;
/*  56:    */     }
/*  57:    */     
/*  58:    */     public String getCommentedBlockCommentPrefix()
/*  59:    */     {
/*  60: 74 */       return null;
/*  61:    */     }
/*  62:    */     
/*  63:    */     public String getCommentedBlockCommentSuffix()
/*  64:    */     {
/*  65: 79 */       return null;
/*  66:    */     }
/*  67:    */   }
/*  68:    */   
/*  69:    */   public static class MyPairedBraceMatcher
/*  70:    */     implements PairedBraceMatcher
/*  71:    */   {
/*  72:    */     private BracePair[] a;
/*  73:    */     
/*  74:    */     public BracePair[] getPairs()
/*  75:    */     {
/*  76: 88 */       if (this.a == null) {
/*  77: 89 */         this.a = new BracePair[] { new BracePair(RncTokenTypes.LBRACE, RncTokenTypes.RBRACE, true), new BracePair(RncTokenTypes.LPAREN, RncTokenTypes.RPAREN, false), new BracePair(RncTokenTypes.LBRACKET, RncTokenTypes.RBRACKET, false) };
/*  78:    */       }
/*  79: 95 */       return this.a;
/*  80:    */     }
/*  81:    */     
/*  82:    */     public boolean isPairedBracesAllowedBeforeType(@NotNull IElementType paramIElementType1, @Nullable IElementType paramIElementType2)
/*  83:    */     {
/*  84:100 */       if (paramIElementType1 == null) {
/*  85:100 */         throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/intellij/plugins/relaxNG/compact/RngCompactLanguage$MyPairedBraceMatcher", "isPairedBracesAllowedBeforeType" }));
/*  86:    */       }
/*  87:100 */       return false;
/*  88:    */     }
/*  89:    */     
/*  90:    */     public int getCodeConstructStart(PsiFile paramPsiFile, int paramInt)
/*  91:    */     {
/*  92:106 */       return paramInt;
/*  93:    */     }
/*  94:    */   }
/*  95:    */   
/*  96:    */   public static class MyNamesValidator
/*  97:    */     implements NamesValidator
/*  98:    */   {
/*  99:    */     public boolean isKeyword(@NotNull String paramString, Project paramProject)
/* 100:    */     {
/* 101:113 */       if (paramString == null) {
/* 102:113 */         throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/intellij/plugins/relaxNG/compact/RngCompactLanguage$MyNamesValidator", "isKeyword" }));
/* 103:    */       }
/* 104:113 */       return RenameUtil.isKeyword(paramString);
/* 105:    */     }
/* 106:    */     
/* 107:    */     public boolean isIdentifier(@NotNull String paramString, Project paramProject)
/* 108:    */     {
/* 109:118 */       if (paramString == null) {
/* 110:118 */         throw new IllegalArgumentException(String.format("Argument %s for @NotNull parameter of %s.%s must not be null", new Object[] { "0", "org/intellij/plugins/relaxNG/compact/RngCompactLanguage$MyNamesValidator", "isIdentifier" }));
/* 111:    */       }
/* 112:118 */       return RenameUtil.isIdentifier(paramString);
/* 113:    */     }
/* 114:    */   }
/* 115:    */   
/* 116:    */   public static class MyDocumentationProvider
/* 117:    */     implements DocumentationProvider
/* 118:    */   {
/* 119:    */     @Nullable
/* 120:    */     public String getQuickNavigateInfo(PsiElement paramPsiElement1, PsiElement paramPsiElement2)
/* 121:    */     {
/* 122:126 */       return null;
/* 123:    */     }
/* 124:    */     
/* 125:    */     public List<String> getUrlFor(PsiElement paramPsiElement1, PsiElement paramPsiElement2)
/* 126:    */     {
/* 127:131 */       return null;
/* 128:    */     }
/* 129:    */     
/* 130:    */     @Nullable
/* 131:    */     public String generateDoc(PsiElement paramPsiElement1, PsiElement paramPsiElement2)
/* 132:    */     {
/* 133:137 */       if ((paramPsiElement1 instanceof RncElement))
/* 134:    */       {
/* 135:138 */         PsiElement localPsiElement = paramPsiElement1.getPrevSibling();
/* 136:139 */         while ((localPsiElement instanceof PsiWhiteSpace)) {
/* 137:140 */           localPsiElement = localPsiElement.getPrevSibling();
/* 138:    */         }
/* 139:142 */         if ((localPsiElement instanceof PsiComment))
/* 140:    */         {
/* 141:143 */           StringBuilder localStringBuilder = new StringBuilder();
/* 142:    */           do
/* 143:    */           {
/* 144:145 */             localStringBuilder.insert(0, EscapeUtil.unescapeText(localPsiElement).replaceAll("\n?##?", "") + "<br>");
/* 145:146 */             localPsiElement = localPsiElement.getPrevSibling();
/* 146:147 */           } while ((localPsiElement instanceof PsiComment));
/* 147:149 */           if ((paramPsiElement1 instanceof RncDefine)) {
/* 148:150 */             localStringBuilder.insert(0, "Define: <b>" + ((RncDefine)paramPsiElement1).getName() + "</b><br>");
/* 149:    */           }
/* 150:153 */           return localStringBuilder.toString();
/* 151:    */         }
/* 152:    */       }
/* 153:156 */       return null;
/* 154:    */     }
/* 155:    */     
/* 156:    */     @Nullable
/* 157:    */     public PsiElement getDocumentationElementForLookupItem(PsiManager paramPsiManager, Object paramObject, PsiElement paramPsiElement)
/* 158:    */     {
/* 159:162 */       return null;
/* 160:    */     }
/* 161:    */     
/* 162:    */     @Nullable
/* 163:    */     public PsiElement getDocumentationElementForLink(PsiManager paramPsiManager, String paramString, PsiElement paramPsiElement)
/* 164:    */     {
/* 165:168 */       return null;
/* 166:    */     }
/* 167:    */   }
/* 168:    */   
/* 169:    */   public static class MySyntaxHighlighterFactory
/* 170:    */     extends SingleLazyInstanceSyntaxHighlighterFactory
/* 171:    */   {
/* 172:    */     @NotNull
/* 173:    */     protected SyntaxHighlighter createHighlighter()
/* 174:    */     {
/* 175:176 */       void tmp7_4 = new RncHighlighter();
/* 176:176 */       if (tmp7_4 == null) {
/* 177:176 */         throw new IllegalStateException(String.format("@NotNull method %s.%s must not return null", new Object[] { "org/intellij/plugins/relaxNG/compact/RngCompactLanguage$MySyntaxHighlighterFactory", "createHighlighter" }));
/* 178:    */       }
/* 179:176 */       return tmp7_4;
/* 180:    */     }
/* 181:    */   }
/* 182:    */ }



/* Location:           E:\idea\

 * Qualified Name:     org.intellij.plugins.relaxNG.compact.RngCompactLanguage

 * JD-Core Version:    0.7.0.1

 */